/**
 * <p>
 * 实现功能：电子档案抬头
 * <p/>
 *
 * @author 秦有宝
 * @version 1.0.00
 */
EUI.ns("EUI.archive");
EUI.ArchiveHead = function () {
    return new EUI.archive.ArchiveHead(arguments[0]);
};
EUI.archive.ArchiveHead = EUI.extend(EUI.CustomUI, {
    renderTo: "content-baseinfo",
    orderCmp: null,
    isView: false,
    isCreate: false,
    initComponent: function() {
        //初始化扩展信息
        //this.initExtInfo();
        //初始化抬头form
        this.initHeadForm();
    },
    initExtInfo: function() {
      /*  var extInfo = [];
        var bookStatus = this.orderCmp.orderData.bookStatus;
        if (bookStatus == "INIT") {
            extInfo.push('<div class="flow-status-info is-init">' + this.orderCmp.orderData.bookStatusRemark + "</div>");
        } else if (bookStatus == "UNBOOK") {
            extInfo.push('<div class="flow-status-info is-unbook">' + this.orderCmp.orderData.bookStatusRemark + "</div>");
        }else if (bookStatus == "BOOKED") {
            extInfo.push('<div class="flow-status-info is-booked">' + this.orderCmp.orderData.bookStatusRemark + "</div>");
        }
        if (this.isCreate) {
            // createTimeText: "制单时间：",
            // creatorText: "制单人：",
            extInfo.push('<div class="order-ext-info order-create-time"><span>' + this.lang.createTimeText + "</span><span></span></div>",
                '<div class="order-ext-info order-creator"><span>' + this.lang.creatorText + "</span><span>" + __SessionUser.userName + "</span></div>");
        } else {
            extInfo.push('<div class="order-ext-info order-create-time"><span>' + this.lang.createTimeText + "</span><span>" + this.orderCmp.orderData.createdDate + "</span></div>",
                '<div class="order-ext-info order-creator"><span>' + this.lang.creatorText + "</span><span>" + this.orderCmp.orderData.creatorName + "</span></div>");
        }
        $("#requestextinfo").empty().append(extInfo.join(""));*/
    },
    initHeadForm: function() {
        var baseItems = this.getHeadItems();
        var formCfg = {
            renderTo: this.renderTo,
            height: "auto",
            // layout: "auto",
            padding: "6px 6px 6px 20px",
            itemspace: 10,
            defaultConfig: {
                readonly: true,
                xtype: "TextField",
                labelWidth: 90
                /*   style:{
                 "margin-top":"5px"
                 }*/
            },
            items: baseItems
        };
        this.headCmp = EUI.FormPanel(formCfg);
        this.headCmp.loadData(this.orderCmp.orderData);
    },
    getHeadItems: function() {
        var headItems = [{
            name: "id",
            hidden: true
        },{
            //orderNoText: "编号",
            title: this.lang.orderNoText,
            width: 300,
            hidden: this.isCreate,
            name: "orderNo"
        },{
            //bookStatusRemarkText: "成册状态",
            title: this.lang.bookStatusRemarkText,
            width: 300,
            name: "bookStatusRemark"
        }, {
            //corporationText: "公司",
            title: this.lang.corporationText,
            width: 300,
            name: "corporationName"
        }, {
            //organizationNameText: "组织机构",
            title: this.lang.organizationNameText,
            name: "organizationName",
            width: 300
        }, {
            //businessTypeText: "业务类型",
            title: this.lang.businessTypeText,
            name: "businessType.name",
            width: 300
        }, {
            //archiveNoteText: "说明",
            xtype:"TextArea",
            height: 50,
            title: this.lang.archiveNoteText,
            width: 300,
            name: "archiveNote",
            allowBlank: this.isView,
            readonly: this.isView || this.orderCmp.orderData.archiveType=="AUTOMATIC",
            maxlength: 200
        }];
        return headItems;
    },
    remove: function() {
        this.headCmp.remove();
        EUI.remove(this.renderTo);
    }
});